<template>
  <div class="formDiv">
    <el-card class="box-card">
      <div class="back">
        <div>
          <el-button
            class="submission priamry_border"
            style="display: flex; float: right"
            @click="back()"
            >返回</el-button
          >
        </div>
      </div>
      <el-form
        ref="ruleForm"
        :model="ruleForm"
        clearable
        label-width="102px"
        class="formArea"
      >
        <el-row>
          <el-col :span="12"
            ><div>
              <!-- 酒店名称 -->
              <el-form-item label="酒店名称 :">
                <span v-html="ruleForm.jdName"> </span>
              </el-form-item></div
          ></el-col>
          <el-col :span="12"
            ><div>
              <!-- 账号名 -->
              <el-form-item label="账号名：">
                <span v-html="ruleForm.account"> </span>
              </el-form-item></div
          ></el-col>
        </el-row>
        <el-row>
          <el-col :span="12"
            ><div>
              <!-- 账号密码 -->
              <el-form-item label="账号密码：">
                <span v-html="ruleForm.password"> </span>
              </el-form-item></div
          ></el-col>
          <el-col :span="12"
            ><div>
              <!-- 平台 -->
              <el-form-item label="平台：">
                <span v-html="ruleForm.platform"> </span>
              </el-form-item></div
          ></el-col>
        </el-row>
        <el-row>
          <el-col :span="12"
            ><div>
              <!-- 状态 -->
              <el-form-item label="状态：">
                <el-tooltip
                  effect="dark"
                  :content="ruleForm.status == '0' ? '禁用' : '启用'"
                  placement="right"
                >
                  <el-switch
                    v-model="ruleForm.status"
                    :active-value="1"
                    :inactive-value="0"
                    disabled
                  >
                  </el-switch>
                </el-tooltip>
              </el-form-item></div
          ></el-col>
        </el-row>
      </el-form>
    </el-card>
  </div>
</template>

<script>
import { getPlatformApi } from "@/api/flatUser";
export default {
  name: "userDetail",
  created() {
    this.getUserInfo(); //根据 ID 查询平台账号
  },
  data() {
    return {
      options: [], //所有酒店名称
      //表单
      ruleForm: {
        jdName: "", //酒店名称
        account: "", //账号名
        password: "", //密码
        status: 1, //状态
        id: 0,
      },
      //查询所有酒店
      hotalForm: {
        limit: 10,
        page: 1,
      },
    };
  },
  methods: {
    //返回上一页
    back() {
      this.$router.go(-1);
    },
    //根据 ID 查询平台账号
    async getUserInfo() {
      const id = JSON.parse(sessionStorage.getItem("data"));
      const res = await getPlatformApi({ id });
      this.ruleForm = res;
    },
    //取消按钮
    cancel() {
      this.$router.go(-1);
    },
  },
};
</script>

<style lang="scss">
.formDiv {
  margin-top: 40px;
  margin-left: 30px;
  .back {
    width: 100%;
    height: 40px;
    display: flex;
    justify-content: end;
  }
  .formArea {
    padding: 0 30px;
    .picUpload {
      width: 800px;
      height: 100px;
      .upLoadPicBox {
        display: flex;
        width: 800px;
        height: 70px;
      }
    }
    .pictrue {
      width: 60px;
      height: 60px;
      border: 1px dotted rgba(0, 0, 0, 0.1);
      margin-right: 10px;
      position: relative;
      cursor: pointer;
    }
    .btndel {
      position: absolute;
      z-index: 1;
      width: 20px !important;
      height: 20px !important;
      left: 46px;
      top: -4px;
    }
  }
  .el-row {
    margin-bottom: 20px;
    &:last-child {
      margin-bottom: 0;
    }
  }
  .el-col {
    border-radius: 4px;
  }
  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }
  .bg-purple {
    background: #d3dce6;
  }
  .bg-purple-light {
    background: #e5e9f2;
  }
  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }

  .el-input__inner {
    width: 30vw;
  }
  .el-select .el-select--medium {
    width: 40vw;
  }
  .buttons {
    width: 100%;
    height: 50px;
  }
}
.upload {
  width: 80px;
  height: 80px;
  // display: flex;
  text-align: center;
  line-height: 80px;
  background-color: pink;
  border: 1px solid #fff;
}
</style>